<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>注册</title>
    <link rel="stylesheet" href="/css/reset.css">
    <link rel="stylesheet" href="/css/resgister.css">
</head>
<body>
<!-- 注册 -->
<div class="resgister-container">
    <img class="login-head-img" src="/images/bg_login.png"/>
    <div class="resgister">
        <h1>注册</h1>
    </div>
    <form onsubmit="return false;">
        <div><label><span>*</span>&nbsp手机号<input name="regPhone" type="text" class="phone"
                                                 placeholder="请输入您的手机号"/></label></div>
        <div><label><span>*</span>&nbsp验证码<input name="regValidateCode" type="text" class="yanzm"
                                                 placeholder="请输入您的验证码"/></label>
            <button class="post-yzm">发送验证码</button>
        </div>
        <div><label>真实姓名<input name="regRealName" type="text" value="" placeholder="请输入您的真实姓名"/> </label></div>
        <div><label>电子邮箱<input name="regEmail" type="text" value="" placeholder="请输入您的电子邮箱"/> </label></div>
        <div><label>工作单位<input name="regWorkUnit" type="text" value="" placeholder="请输入您的工作单位"/> </label></div>
        <div><label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;职位<input name="regJob" type="text" value=""
                                                                 placeholder="请输入您的职位"/> </label></div>
        <div class="toLogin"><a href="/user/toLogin">已有账号，去登录</a></div>
        <button id="registerBtn" class="regeiter">注册</button>
    </form>
</div>
<jsp:include page="../common/jsResources.jsp"/>
<script>
    $(document).ready(function () {
        $("#registerBtn").click(function() {
            var inputObject = getValuesByInputName([ "regPhone", "regValidateCode", "regRealName", "regEmail", "regWorkUnit", "regJob"]);
            if(judgeInputValue(inputObject.regPhone, "phone")) return false;
            if(judgeInputValue(inputObject.regValidateCode, "notEmpty", "请输入验证码")) return false;
            if(judgeInputValue(inputObject.regEmail, "email")) return false;
            var registerSucFunc = function(result) {
                location.href = "/user/toLogin";
            }
            ajaxByMethod("${ctx}/user/sign", "post", inputObject, registerSucFunc);
        });
    })
</script>
</body>
</html>
